// Real.h: interface for the Real class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_REAL_H__ABE07477_AA16_46A3_9209_BA9B2096A875__INCLUDED_)
#define AFX_REAL_H__ABE07477_AA16_46A3_9209_BA9B2096A875__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

enum Spec
{
	eUnknown,
	eNormal
};

template<class _Ty>
class Real
{
public:
	Real() : rt( eUnknown ) {}
	Real( _Ty aVal, Spec aSpec = eNormal ) : val( aVal ), rt( aSpec ) {}
	~Real() {}
	Real( const Real& aReal ) : rt( aReal.rt ), val( aReal.val ) {}
	Real& operator= ( const Real& aReal ) {	val = aReal.val; rt = aReal.rt;	return *this; }
	Real& operator= ( const _Ty aVal ) { val = aVal; rt = eNormal; return *this; }
	operator _Ty& () { return val; }
	bool operator == ( const Real& aReal ) const { return rt == aReal.rt && val == aReal.val; }
	bool operator == ( const _Ty& aVal ) const { return rt != eUnknown && val == aVal; }
	bool operator != ( const Real& aReal ) const { return !( operator==( aReal ) ); }
	bool operator != ( const _Ty& aVal ) const { return !( operator==( aVal ) ); }

public:
	bool IsUnknown() const { return rt == eUnknown; }
	bool IsNormal() const { return rt == eNormal; }

public:
	void Set( _Ty aVal, Spec aSpec = eNormal ) {
		val = aVal;
		rt = aSpec;
	}
	void SetSpec( Spec aSpec ) { rt = aSpec; }

	_Ty& GetValue(){
		return val;
	}

private:
	_Ty val;
	Spec rt;

};


#endif // !defined(AFX_REAL_H__ABE07477_AA16_46A3_9209_BA9B2096A875__INCLUDED_)
